"""The Export module contains the Export class, that exports playlists in different formats"""

import os

class Export:
    def __init__(self):
        pass

    def export(self, list, format, filename):
        if format == "Media Player Classic":
            self.exportMPC(list, filename)

    def exportMPC(self, list, filename):
        output = "MPCPLAYLIST\n"
        index = 0
        for item in list:
            index = index + 1
            output += str(index) + ",type,0\n"
            output += str(index) + ",filename," + item["folder"] + "\\" + item["filename"] + "\n"
        file = open(filename, "w")
        file.write(output)